home *** CD-ROM | disk | FTP | other *** search
-
- /* File: ~eden/Kernel/Em/mainLoop.c Origin: 1985-07-09 eric */
-
- /* C O P Y R I G H T N O T I C E : */
- /* Copyright 1986 Eric Jul and Norm Hutchinson. May not be used for any */
- /* purpose without written permission from the authors. */
-
- /* Revision 2.0 started 1985-09-13 */
- /* Revision 3.0 started 1986-02-20 */
- /* Revision 3.1 started 1986-03-01 */
-
- /* This is the main loop for handling the kernel task queue.
- */
-
- #include "Kernel/h/stdTypes.h"
- #include "Kernel/h/kmdTypes.h"
- #include "Kernel/h/kEvents.h"
- #include "Kernel/h/emTypes.h"
-
- #ifndef NULL
- #define NULL 0
- #endif NULL
- /*
- * MainLoop()
- *
- * The main loop. Checks TaskQ, and if there are any tasks waiting to
- * run, calls them. Does HoldSigs() and ReleaseSigs() to protect the queue.
- */
- extern void edenPause();
- extern void ErrMsg();
-
- /**********************************************************************/
-
- void MainLoop()
- {
- struct TaskQueue *event;
- int (*handler)();
- char *argument;
- doMore:
- #ifndef xkernel
- HoldSigs();
- #endif
- event = TaskDequeue(&TaskQ);
- if (event != (struct TaskQueue *) NULL) {
- handler = event->handler;
- argument = event->arg;
- TaskEnqueue(&FreeQ, event);
- #ifndef xkernel
- ReleaseSigs();
- #endif
- DebugMsg(7, "Calling handler 0x%06x with 0x%06x\n", handler, argument);
- (void) ((*handler)(argument));
- DebugMsg(7, "Handler 0x%06x returned\n", handler);
- goto doMore;
- }
- }
-
- /* C O P Y R I G H T N O T I C E : */
- /* Copyright 1986 Eric Jul and Norm Hutchinson. May not be used for any */
- /* purpose without written permission from the authors. */
-